BTIC1G
BTIC1G Goals: * Simple Encoder * Bounded worst case bitrate * Incremental images * Inline image data Will aim to have a lower average bitrate than 1C. Colorspace: * Either YCbCr or a scaled RCT. * YCbCr: ** Y=( 0.35R+0.50G+0.15B) ** U=(-0.17R-0.33G+0.50B)+128 ** V=( 0.50R-0.42G-0.08B)+128 * ScRCT ** Y=(0.25R+0.50G+0.25B) ** U=(0.50B-0.50G)+128 ** V=(0.50R-0.50G)+128 Block Color * 23 bit pair (YUV23A): ** X: 1 (0) ** Y: 7 ** D: 6 ** U: 5 ** V: 5 * 22 bit pair (YUV22B): ** X: 1 (0) ** M: 2 (Mode) *** 0: Flat (Simple Case: D=0) **** Bits within D are used for special cases. *** 1: 2x2x2 *** 2: 4x4x1 *** 3: 4x4x2 ** Y: 7 ** D: 6 ** U: 4 ** V: 4 * 15 bit flat color (YUV15): ** X: 1 ** Y: 7 ** U: 4 ** V: 4 YUV specifies the centroid color (RCT), and d=Ymax-Yavg. * Both Y and D will be linear. * Y and D are normally unpacked with high bits folded to low-bits to make 8-bit values. UV Points: * UV points will follow curves. * 3-bit: ** 0 56 96 120 128 136 160 200 * 4-bit: ** 0 30 56 78 96 110 120 126 128 130 136 146 160 178 200 226 * 5-bit: ** 0 15 30 43 56 67 78 87 96 103 110 115 120 123 126 127 ** 128 129 130 133 136 141 146 153 160 169 178 189 200 213 226 241 Extension: HF Color 0: * YUV22C (YUV22B Esc) ** X: 1 (0) ** Me=0: 2 (Mode, Escape) ** Dx: 7 (Reserved) ** M: 6 *** 0: Invalid *** 1..7: Reserved *** 8: 4x4x2 *** 9: 4x4x3 *** 16: HF-Flat (24 bit Flat Color) *** 17: 4x4x2 (Dyuv) *** 18: 4x4x2Y+2x2U+2x2V (DYUV) * M=8,9,16,17,18 ** Y: 8 ** U: 8 ** V: 8 * M=8,9,17,18 ** D: 8 * M=17,18 ** Du: 8 ** Dv: 8 Pixel Data: * Xsz x Ysz x Bits * 1bpp ** 0=Low Color ** 1=High Color * 2bpp ** 0=Low ** 1=2/3 Low + 1/3 High ** 2=1/3 Low + 2/3 High ** 3=High Commands: * 00-7F: Raw Block ** / 23-bit color, 4x4x2bpp (if d!=0) ** YUV22B, followed by pixel data. ** Special Case: 16-bit Flat Block: *** 000Y-YYYY YUUU-VVV1 ** Special Case 2: 24-bit Flat Block 2: *** 000Y-YYYY YYYU-VP10 UUUU-VVVV **** Y=8-bit, U/V=5+1 bit (P bit is shared between U and V). **** The U/V bits located in the D field are least-significant bits. * 80-8F: Skip * 90-9F: Flat Color ** Run of single flat color (YUV15) * A0-AF: Discrete Colors ** Each block represented by a single color. * B0-BF: 2x2x2bpp * C0-CF: 4x4x1bpp * D0-DF: 4x4x2bpp ** YUV23 color-point, followed by pixel data. * E0-FF: Extended Commands ** E0: End Of Data ** E1-E6: Reserved for markers. ** E8: Skip+Translate *** High 3 bits: **** 0=Extended Skip (13 bit) ***** 000n-nnnn nnnn-nnnn **** 1=Skip+Translate (5-bit), Y:4 (Bias=8), X:4 (Bias=8) ***** 001n-nnnn yyyy-xxxx **** 2=Skip+Translate (9-bit), Y:6 (Bias=32), X:6 (Bias=32) ***** 010n-nnnn nnnn-yyyy yyxx-xxxx ** E9: Set Controller ** EA: Extended Block Commands *** ooon-nnnn *** 00-1F: Raw Blocks With Differential Coding **** Each block is encoded as a raw block. **** Color.X may be used for differential colors. For blocks, Color.X indicates the use of differential colors: * 0: Discrete color point * 1: Delta from prior colors. YUV15: * Discrete: Implicitly sets D to 0. * Differential: Does not effect D. Differential values will be center-biased (Identity=128), operating on logical 8-bit values and will be 8-bit modular. BTIC1G2 (Drop) Possible bitstream coded version. Bitstream will be encoded is MSB first order. Superseded / Became: BTIC1H AdRice: * Will have a unary prefix (Q) of 0+ 1 bits, terminated by a 0 bit. * This will be followed by a k bit suffix (j). ** Value=(Q<0)k=k-1; ** 1: k is unchanged. ** 2+: k=k+log2(Q). Here, AdRice contexts will start with an initial value of 2 unless specified otherwise. Signed Rice values will have the sign folded into the LSB (0, -1, 1, -2, 2, ...). Normal Colors are 7655, flat colors are 755. * Color points are encoded with a leading bit: ** 0: Discrete Color, encoded as 7655 or 755. ** 1: Diff Color, encoded as 3 or 4 AdRice coded deltas. *** Each AdRice point has its own context. * 7655D: Will mean 7655 or Diff (4 value). * 755D: Will mean 755 or Diff (3 value). Commands will start with a 3-bit tag: * 0: Raw Block ** 2 Bit Mode Follows ** M=0: Flat Color, 755D Color point follows. ** M=1: 2x2x2bpp, Followed by 7655D and 2x2x2bpp. ** M=2: 4x4x1bpp, Followed by 7655D and 4x4x1bpp. ** M=3: 4x4x2bpp, Followed by 7655D and 4x4x2bpp. * 1: Skip ** Length Follows ** Translate bit follows: *** 0: No Translate *** 1: Translate **** AdRice coded X/Y offsets follow. * 2: Flat Color ** Length Follows ** Followed by 755D point. * 3: Discrete Colors ** Length Follows ** Each block given as a 755D point. * 4: 2x2x2bpp * 5: 4x4x1bpp * 6: 4x4x2bpp ** Length Follows ** Each 7655D point follows. ** Followed by pixel data for each block. * 7: Escape ** Another 5 bits follows. Possible could be to use 6-bit MTF+Rice for commands: * High 3: Command * Low 3: Depends on command ** Raw: Mode (4-7=Reserved) ** Skip, TCC *** T=Translate *** CC=Count, 0-2: 1-3 blocks, 3=Length follows ** Pixel Blocks *** Encodes a length, where 0-6=1-7 blocks, 7=Length follows. ** Escape, Encodes op bits.